<?php
//二维数组按照 一维中的某个key值排序
function SortArray($arr,$keys,$type='asc')
{     
	$keysvalue = $new_array = array(); 
	foreach ($arr as $k=>$v)
	{       
		$keysvalue[$k] = $v[$keys];    
    } 
if($type == 'asc')
{       
	asort($keysvalue);     
}
else
{      
	arsort($keysvalue);  
}    
reset($keysvalue);  
foreach ($keysvalue as $k=>$v)
{     
	if($v != -1)
	{
	 $new_array[$k] = $arr[$k];   
	}
} 
foreach ($keysvalue as $k=>$v)
{     
	if($v == -1)
	{
	 $new_array[$k] = $arr[$k];   
	}
} 

return $new_array;  
}
?>